package game.net.server;

import java.util.ArrayList;
import java.util.List;

public class ErrorLog {

	private List<Throwable> log = new ArrayList<Throwable>();

	public void reportError(Throwable e) {
		if (log != null) {
			log.add(e);
		} else {
			e.printStackTrace();
		}
	}

	public int size() {
		return log.size();
	}

	public boolean hasError(String errorMessage) {
		boolean output = false;
		for (Throwable err : log) {
			if(err.getMessage().indexOf(errorMessage) >= 0)
				output = true;
		}
		return output;
	}

}
